<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />


<div class="t_bar">
	<span class="color_red">*</span>首席农艺师名单（至少30个农民专业合作社或涉农企业）
	<security:authorize ifNotGranted="A_DAILU_PROPOSAL">
	<!-- <span style="font-size: 12px;font-weight: normal;">
		（如果您需要修改申请人信息， 请保存申请书后点击菜单“管理”>“个人信息维护”完成修改）
	</span> -->
	</security:authorize>
</div>
	<table  id="ny_persons" cellpadding="0" class="table01" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;" >
		<thead>
			<tr>
            <th class="TblHead" align="center" width="4%" >选择</th>
            <th class="TblHead" align="center" nowrap width="4%">序号</th>
				<th class="TblHead" align="center" width="7%">姓名</th>
				<th class="TblHead" align="center" width="5%">性别</th>
				<th class="TblHead" align="center" width="13%">出生年月</th>
				<th class="TblHead" align="center" width="10%">从事专业/职称</th>
				<th class="TblHead" align="center" width="20%">所在单位</th>
				<th class="TblHead" align="center" width="11%">手机号码</th>
				<th class="TblHead" align="center" width="10%">服务的农民专业合作社（涉农企业）名称/理事长姓名</th>
				<th class="TblHead" align="center" width="11%">理事长<br />手机号码</th>
			</tr>
		</thead>
		<tbody id="tab">
			<tr style="display: none">
				<td  align="center" >
					<input type="radio" name="sel_ny_persons" onclick="setSubmitPsn()"   class="input_text "/> 
				</td>
				<td align="center">
					<span name="ny_persons|ny_person[0]@seq_no" >[index]</span>
				</td>
				<td align="center">
					<input name="ny_persons|ny_person[0]|zh_name" style="width:80%;"  class="input_text required" maxlength="30" label="姓名"/>
				</td>
				<td align="center">
					<cpt:select id="gender[index]" name="gender" key="gender" onChange="initControlValue(this.id);" style="width:95%"></cpt:select>
					<input type="hidden" name="ny_persons|ny_person[0]|gender_value" class="required" label="性别" value=""/>
					<input type="hidden" name="ny_persons|ny_person[0]|gender_name" value=""/>
				</td>
				<td align="center">
					<!-- <input name="ny_persons|ny_person[0]|birthday" style="width:90%;" /> -->
					
					<cpt:date id="birthday[index]" className="required date beforeToday inputWidth input_text" label="出生年月"   name="ny_persons|ny_person[0]|birthday" ></cpt:date> 
				</td>
				<td align="center">
					<input name="ny_persons|ny_person[0]|position" style="width:85%;" class="input_text required" maxlength="100" label="从事专业/职称"/>
				</td>
				<td align="center">
					<input  name="ny_persons|ny_person[0]|org_name" style="width:90%;" class="input_text required" maxlength="100" label="所在单位"/>
				</td>
				<td align="center">
					<input name="ny_persons|ny_person[0]|mobile" style="width:85%;" class="input_text required mobile" maxlength="11" label="手机号码"/>
				</td>
				<td align="center">
					<input name="ny_persons|ny_person[0]|chairman_name"  style="width:85%;"  class="input_text required" maxlength="30" label="服务的农民专业合作社（涉农企业）名称/理事长姓名"/>
				</td>
				<td align="center">
					<input name="ny_persons|ny_person[0]|chairman_mobile" style="width:85%;"   class="input_text required mobile" maxlength="11" label="理事长手机号码"/>
				</td>
			</tr>
			<c:set value="0" var="index" scope="page" />
			<x:forEach select="$xmlData/data/ny_persons/ny_person" var="ny_person">
				<c:choose>
					<c:when test="${index<10}">
						<c:set value="0" var="flag" scope="page" />
					</c:when>
					<c:otherwise>
						<c:set value="" var="flag" scope="page" />
					</c:otherwise>
				</c:choose>
				<tr>
					<td  align="center" >
						<input type="radio" name="sel_ny_persons" onclick="setSubmitPsn()" /> 
					</td>
					<td align="center">
					<span name="ny_persons/ny_person[${flag}${index}]@seq_no">${index+1}</span>
					</td>
					<td align="center">
						<input name="ny_persons/ny_person[${flag}${index}]/zh_name" style="width:80%;" class="input_text required" label="姓名"
						maxlength="30" value="<x:out select="$ny_person/zh_name" />" />
						<%-- <security:authorize ifAnyGranted="A_DAILU_PROPOSAL">
						<c:if test="${index==0 }"><a href="###" class="Blue" style="text-decoration: none;" onclick="selectFirstRadio(this);editRow('ny_persons','${ctx}/proposal/edit/dialog/psnInfoEdit_sxry?parentTab=ny_persons&type=edit&needMeetingInfo=${param.needMeetingInfo}&psnCode=<x:out select="$ny_person/psn_code" />&TB_iframe=true&height=440&width=900','编辑项目参与人信息')">[&nbsp;设置&nbsp;]</a></c:if>
						</security:authorize> --%>
					</td>
					<td align="center">
						<%-- <input name="ny_persons/ny_person[${flag}${index}]/gender" style="width:90%;" value="<x:out select="$ny_person/gender" />" /> --%>
					
						<c:set var="gender_value"><x:out select="$ny_person/gender_value" /></c:set>
				   	<cpt:select id="gender${index}" key="gender" name="gender" onChange="initControlValue(this.id);" value="${gender_value }" style="width:95%"></cpt:select>
			         <input type="hidden" name="ny_persons/ny_person[${flag}${index}]/gender_value" class="required" label="性别" value="<x:out select="$ny_person/gender_value" />"/>
			         <input type="hidden" name="ny_persons/ny_person[${flag}${index}]/gender_name" value="<x:out select="$ny_person/gender_name" />"/>
					
					</td>
					<td align="center">
						<%-- <input name="ny_persons/ny_person[${flag}${index}]/birthday" style="width:90%;" value="<x:out select="$ny_person/birthday" />" /> --%>
						<c:set var="birthday"><x:out select="$ny_person/birthday" /></c:set>
						<cpt:date id="birthday${index}" className="required date beforeToday inputWidth" label="出生年月"   name="ny_persons/ny_person[${flag}${index}]/birthday" value="${birthday }"></cpt:date>
					</td>
					<td align="center">
						<input name="ny_persons/ny_person[${flag}${index}]/position" style="width:85%;" class="input_text required"
						maxlength="100" value="<x:out select="$ny_person/position" />"  label="从事专业/职称"/>
					</td>
					
					<td align="center">
						<input name="ny_persons/ny_person[${flag}${index}]/org_name" style="width:90%;" class="input_text required"
						maxlength="100" value="<x:out select="$ny_person/org_name" />"  label="所在单位"/>
					</td>
					<td align="center"> 
						<input name="ny_persons/ny_person[${flag}${index}]/mobile" style="width:85%;"
						maxlength="11" class="input_text required mobile" label="手机号码"
						 value="<x:out select="$ny_person/mobile" />" />
					</td>
					<td align="center">
						<input name="ny_persons/ny_person[${flag}${index}]/chairman_name" style="width:85%;"  
						class="input_text required" label="服务的农民专业合作社（涉农企业）名称/理事长姓名"
						maxlength="30" value="<x:out select="$ny_person/chairman_name" />" />
					</td>
					<td align="center">
						<input name="ny_persons/ny_person[${flag}${index}]/chairman_mobile" style="width:85%;" 
						maxlength="11" class="input_text required mobile" label="理事长手机号码"
						value="<x:out select="$ny_person/chairman_mobile" />" />
					</td>
				</tr>
				<c:set value="${index+1}" var="index" scope="page" />
			</x:forEach>
			</tbody>
	</table>
<br>

	<table border="0" cellpadding="0" cellspacing="1">
		<tr>
			<td>
				<input class="button_02" type="button" value="添加"  onclick="if(checkTabLimit('ny_persons',99,'项目参与人员最多只能填写99条')){addNewRow('ny_persons');}try{top.resizeFrame();}catch(e){};">
				&nbsp;<input class="button_02"  id="zh_psnPrev" type="button" value="上移" onclick="movePrev('ny_persons');setSubmitPsn()">
				&nbsp;<input class="button_02"  id="zh_psnNext" type="button" value="下移" onclick="moveNext('ny_persons');setSubmitPsn()">
				<%-- &nbsp;<input class="button_02"  id="zh_psnEdit" type="button" value="编辑" onclick="if(checkSubmitPsn('ny_persons'))editRow('ny_persons','${ctx}/proposal/edit/dialog/psnInfoEdit_ybyf?parentTab=ny_persons&type=edit&needMeetingInfo=${param.needMeetingInfo}&TB_iframe=true&height=440&width=900','编辑项目参与人信息')"> --%>
				&nbsp;<input class="button_02"  id="zh_psnDel" type="button" value="删除" onclick="deleteSelectedRow('ny_persons','首席农艺师');"></td>
		</tr>
	</table>
	 
<script type="text/javascript">
function selectFirstRadio(obj) {
	$(obj).parent('td').parent('tr').find('input[type="radio"]').attr("checked","checked");
	setSubmitPsn();
}
/* function checkSubmitPsn(tableId){
	<security:authorize ifNotGranted="A_DAILU_PROPOSAL">
	var tr=$("#"+tableId+" :radio:checked").parents("tr");
	if(tr.length!=0 && tr.get(0).rowIndex==2){
		scmWarn('如果您需要修改申请人信息， 请保存申请书后点击菜单“管理”>“个人信息维护”完成修改');
		return false;
	}
	</security:authorize>
	
	return true;
		
} */
/* function psnSynchro(){
	$("span[name$='fzr_psnname']").text($("#ny_persons tr:eq(2)").find("span[name$='zh_name']").text());
	$("span[name$='fzr_tel']").text($("#ny_persons tr:eq(2)").find("input[name$='contact/tel_work']").val());
	$("span[name$='fzr_mobile']").text($("#ny_persons tr:eq(2)").find("input[name$='contact/mobile']").val());
	$("span[name$='fzr_mail']").text($("#ny_persons tr:eq(2)").find("input[name$='contact/email']").val());
} */

function setSubmitPsn() {
	if($("#ny_persons :radio:checked").length==0){
		scmWarn('请选择一行!');
		return false;
	}
	var tr = $("#ny_persons :radio:checked").parents("tr");
	if (tr.get(0).rowIndex - 1 == 1) {// 如果选择的是申报人
		$("#zh_psnPrev").attr("disabled", "true").css("color", "#808080");
		//$("#zh_psnNext").attr("disabled", "true").css("color", "#808080");
		// $("#zh_psnEdit").attr("disabled","true").css("color","#808080");
		//$("#zh_psnDel").attr("disabled", "true").css("color", "#808080");

	} else {// 如果是申报书的下一行
		$("#zh_psnPrev").removeAttr("disabled").css("color", "#003366");
		//$("#zh_psnNext").removeAttr("disabled").css("color", "#003366");
		//$("#zh_psnDel").removeAttr("disabled").css("color", "#003366");
	} 
}
</script>